<template>
    个人设置页
    <p>修改手机号</p>
    <div>
        手机号: <input type="text" v-model="phone">
    </div>
    <div>
        <button @click="updatePhone">提交</button>
    </div>
</template>


<script setup>
import {ref} from 'vue'
import {useStore} from 'vuex'
import {useRouter} from 'vue-router'

// store的实例化对象
const store = useStore()
// 路由的实例化对象
const router = useRouter()

const phone =ref('')

const updatePhone = ()=>{
    store.commit("updateUserInfo",{
        ...store.state.userInfo,
        phone
    })

    router.push({path:'/user/profile'})
}

</script>